<!--
Copyright (c) 2019-2026, Hossein Moein
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.
* Neither the name of Hossein Moein and/or the DataFrame nor the
  names of its contributors may be used to endorse or promote products
  derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Hossein Moein BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE html>
<html>

<head>
<style>
body {
  background-image: linear-gradient(Azure, AliceBlue, GhostWhite, WhiteSmoke);
}
</style>
</head>

<body style="font-family: Georgia, serif">
  <font size="+3">&#8592;</font> <a href="https://htmlpreview.github.io/?https://github.com/hosseinmoein/DataFrame/blob/master/docs/HTML/DataFrame.html">Back to Documentations</a><BR><BR>
  
  <table border="1">

    <tr bgcolor="lightblue">
        <th>Signature</th> <th>Description</th> <th>Parameters</th>
    </tr>
    <tr bgcolor="Azure">
      <td>
<pre class="code_syntax" style="color:#000000;background:#ffffff00;"><span class="line_wrapper"><span style="color:#800000; font-weight:bold; ">template</span><span style="color:#800080; ">&lt;</span><span style="color:#800000; font-weight:bold; ">typename</span> T<span style="color:#800080; ">&gt;</span></span>
<span class="line_wrapper"><span style="color:#800000; font-weight:bold; ">static</span> <span style="color:#666616; ">std</span><span style="color:#800080; ">::</span><span style="color:#603000; ">vector</span><span style="color:#800080; ">&lt;</span><span style="color:#800000; font-weight:bold; ">typename</span> I<span style="color:#800080; ">&gt;</span></span>
<span class="line_wrapper">gen_datetime_index<span style="color:#808030; ">(</span><span style="color:#800000; font-weight:bold; ">const</span> <span style="color:#800000; font-weight:bold; ">char</span> <span style="color:#808030; ">*</span>start_datetime<span style="color:#808030; ">,</span></span>
<span class="line_wrapper">                   <span style="color:#800000; font-weight:bold; ">const</span> <span style="color:#800000; font-weight:bold; ">char</span> <span style="color:#808030; ">*</span>end_datetime<span style="color:#808030; ">,</span></span>
<span class="line_wrapper">                   <a href="https://htmlpreview.github.io/?https://github.com/hosseinmoein/DataFrame/blob/master/docs/HTML/time_frequency.html">time_frequency</a> t_freq<span style="color:#808030; ">,</span></span>
<span class="line_wrapper">                   <span style="color:#800000; font-weight:bold; ">long</span> increment <span style="color:#808030; ">=</span> <span style="color:#008c00; ">1</span><span style="color:#808030; ">,</span></span>
<span class="line_wrapper">                   DT_TIME_ZONE tz <span style="color:#808030; ">=</span> DT_TIME_ZONE<span style="color:#800080; ">::</span>LOCAL<span style="color:#808030; ">)</span><span style="color:#800080; ">;</span></span>
<span class="line_wrapper"></span></pre>
      </td>
      <td>
        This static method generates a date/time-based index vector that could be fed directly to one of the load methods. Depending on the specified frequency, it generates specific timestamps (see below).<BR>
        It returns a vector of I timestamps.<BR>
        Currently I could be any built-in numeric type or DateTime<BR>
        <B>NOTE</b>: It is the responsibility of the programmer to make sure I type is big enough to contain the frequency.
      </td>
      <td>
        <B>start_datetime, end_datetime</B>: They are the start/end date/times of requested timestamps.<BR>
        They must be in the following format:<BR>
        <I>MM/DD/YYYY [HH[:MM[:SS[.MMM]]]]</I><BR>
        <B>t_freq</B>: Specifies the timestamp frequency. Depending on the frequency,
        and I type specific timestamps are generated as follows:<BR>
        <UL>
          <LI>I type of DateTime always generates timestamps of DateTime.</LI>
          <LI>Annual, monthly, weekly, and daily frequencies generates <I>YYYYMMDD</I> timestamps.</LI>
          <LI>Hourly, minutely, and secondly frequencies generates epoch timestamps (64 bit).</LI>
          <LI>Millisecondly frequency generates nano-second since epoch timestamps (128 bit).</LI>
        </UL>
        <B>increment</B>: Increment in the units of the frequency<BR>
        <B>tz</B>: Time-zone of generated timestamps
      </td>
    </tr>

  </table>

  <pre style='color:#000000;background:#ffffff00;'><span style='color:#800000; font-weight:bold; '>static</span> <span style='color:#800000; font-weight:bold; '>void</span> test_gen_datetime_index<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>  <span style='color:#800080; '>{</span>

    <span style='color:#666616; '>std</span><span style='color:#800080; '>::</span><span style='color:#603000; '>cout</span> <span style='color:#808030; '>&lt;</span><span style='color:#808030; '>&lt;</span> <span style='color:#800000; '>"</span><span style='color:#0f69ff; '>\n</span><span style='color:#0000e6; '>Testing gen_datetime_index() ...</span><span style='color:#800000; '>"</span> <span style='color:#808030; '>&lt;</span><span style='color:#808030; '>&lt;</span> <span style='color:#666616; '>std</span><span style='color:#800080; '>::</span><span style='color:#603000; '>endl</span><span style='color:#800080; '>;</span>

    <span style='color:#666616; '>std</span><span style='color:#800080; '>::</span><span style='color:#603000; '>vector</span><span style='color:#800080; '>&lt;</span><span style='color:#800000; font-weight:bold; '>unsigned</span> <span style='color:#800000; font-weight:bold; '>long</span><span style='color:#800080; '>></span>  idx_vec1 <span style='color:#808030; '>=</span>
        MyDataFrame<span style='color:#800080; '>::</span>gen_datetime_index<span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>12/31/2038</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> time_frequency<span style='color:#800080; '>::</span>annual<span style='color:#808030; '>,</span> <span style='color:#008c00; '>1</span><span style='color:#808030; '>,</span> DT_TIME_ZONE<span style='color:#800080; '>::</span>AM_NEW_YORK<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>

    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>size<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>21</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>capacity<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>22</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20180101</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20190101</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>10</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20280101</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>20</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20380101</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>

    idx_vec1 <span style='color:#808030; '>=</span> MyDataFrame<span style='color:#800080; '>::</span>gen_datetime_index<span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>12/31/2038</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> time_frequency<span style='color:#800080; '>::</span>monthly<span style='color:#808030; '>,</span> <span style='color:#008c00; '>3</span><span style='color:#808030; '>,</span> DT_TIME_ZONE<span style='color:#800080; '>::</span>AM_NEW_YORK<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>size<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>84</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>capacity<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>86</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20180101</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20180401</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20180701</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>40</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20280101</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>83</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20381001</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>

    idx_vec1 <span style='color:#808030; '>=</span> MyDataFrame<span style='color:#800080; '>::</span>gen_datetime_index<span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>12/31/2038</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> time_frequency<span style='color:#800080; '>::</span>weekly<span style='color:#808030; '>,</span> <span style='color:#008c00; '>4</span><span style='color:#808030; '>,</span> DT_TIME_ZONE<span style='color:#800080; '>::</span>AM_NEW_YORK<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>size<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>274</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>capacity<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>274</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20180101</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20180129</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20180226</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>272</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20381108</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>273</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20381206</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>

    idx_vec1 <span style='color:#808030; '>=</span> MyDataFrame<span style='color:#800080; '>::</span>gen_datetime_index<span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>12/31/2038</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> time_frequency<span style='color:#800080; '>::</span>daily<span style='color:#808030; '>,</span> <span style='color:#008c00; '>1</span><span style='color:#808030; '>,</span> DT_TIME_ZONE<span style='color:#800080; '>::</span>AM_NEW_YORK<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>size<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>7669</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>capacity<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>7670</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20180101</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20180102</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20180103</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>7667</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20381229</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>7668</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>20381230</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>

    idx_vec1 <span style='color:#808030; '>=</span> MyDataFrame<span style='color:#800080; '>::</span>gen_datetime_index<span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>12/31/2022</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> time_frequency<span style='color:#800080; '>::</span>hourly<span style='color:#808030; '>,</span> <span style='color:#008c00; '>1</span><span style='color:#808030; '>,</span> DT_TIME_ZONE<span style='color:#800080; '>::</span>AM_NEW_YORK<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>size<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>43800</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>capacity<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>43801</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514782800</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514786400</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514790000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>43798</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1672455600</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>43799</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1672459200</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>

    idx_vec1 <span style='color:#808030; '>=</span> MyDataFrame<span style='color:#800080; '>::</span>gen_datetime_index<span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>03/31/2018</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> time_frequency<span style='color:#800080; '>::</span>secondly<span style='color:#808030; '>,</span> <span style='color:#008c00; '>10</span><span style='color:#808030; '>,</span> DT_TIME_ZONE<span style='color:#800080; '>::</span>AM_NEW_YORK<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>size<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>768600</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>capacity<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>768601</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514782800</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514782810</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514782820</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>768598</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1522468780</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>768599</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1522468790</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>

    idx_vec1 <span style='color:#808030; '>=</span> MyDataFrame<span style='color:#800080; '>::</span>gen_datetime_index<span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018 00:00:00.000</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018 10:10:01.600</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> time_frequency<span style='color:#800080; '>::</span>millisecondly<span style='color:#808030; '>,</span> <span style='color:#008c00; '>500</span><span style='color:#808030; '>,</span> DT_TIME_ZONE<span style='color:#800080; '>::</span>AM_NEW_YORK<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>size<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>73204</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>.</span>capacity<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>73229</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514782800000000000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514782800500000000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514782801000000000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>73201</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514819400500000000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>73202</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514819401000000000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec1<span style='color:#808030; '>[</span><span style='color:#008c00; '>73203</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>1514819401500000000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>

    <span style='color:#666616; '>std</span><span style='color:#800080; '>::</span><span style='color:#603000; '>vector</span><span style='color:#800080; '>&lt;</span>DateTime<span style='color:#800080; '>></span>   idx_vec2 <span style='color:#808030; '>=</span>
        StdDataFrame<span style='color:#800080; '>&lt;</span>DateTime<span style='color:#800080; '>></span><span style='color:#800080; '>::</span>gen_datetime_index<span style='color:#808030; '>(</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>12/31/2022</span><span style='color:#800000; '>"</span><span style='color:#808030; '>,</span> time_frequency<span style='color:#800080; '>::</span>hourly<span style='color:#808030; '>,</span> <span style='color:#008c00; '>1</span><span style='color:#808030; '>,</span> DT_TIME_ZONE<span style='color:#800080; '>::</span>AM_NEW_YORK<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>

    assert<span style='color:#808030; '>(</span>idx_vec2<span style='color:#808030; '>.</span>size<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#008c00; '>43800</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec2<span style='color:#808030; '>[</span><span style='color:#008c00; '>0</span><span style='color:#808030; '>]</span><span style='color:#808030; '>.</span>string_format <span style='color:#808030; '>(</span>DT_FORMAT<span style='color:#800080; '>::</span>DT_TM2<span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018 00:00:00.000</span><span style='color:#800000; '>"</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec2<span style='color:#808030; '>[</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>]</span><span style='color:#808030; '>.</span>string_format <span style='color:#808030; '>(</span>DT_FORMAT<span style='color:#800080; '>::</span>DT_TM2<span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018 01:00:00.000</span><span style='color:#800000; '>"</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec2<span style='color:#808030; '>[</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>]</span><span style='color:#808030; '>.</span>string_format <span style='color:#808030; '>(</span>DT_FORMAT<span style='color:#800080; '>::</span>DT_TM2<span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>01/01/2018 02:00:00.000</span><span style='color:#800000; '>"</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec2<span style='color:#808030; '>[</span><span style='color:#008c00; '>43798</span><span style='color:#808030; '>]</span><span style='color:#808030; '>.</span>string_format <span style='color:#808030; '>(</span>DT_FORMAT<span style='color:#800080; '>::</span>DT_TM2<span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>12/30/2022 22:00:00.000</span><span style='color:#800000; '>"</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
    assert<span style='color:#808030; '>(</span>idx_vec2<span style='color:#808030; '>[</span><span style='color:#008c00; '>43799</span><span style='color:#808030; '>]</span><span style='color:#808030; '>.</span>string_format <span style='color:#808030; '>(</span>DT_FORMAT<span style='color:#800080; '>::</span>DT_TM2<span style='color:#808030; '>)</span> <span style='color:#808030; '>=</span><span style='color:#808030; '>=</span> <span style='color:#800000; '>"</span><span style='color:#0000e6; '>12/30/2022 23:00:00.000</span><span style='color:#800000; '>"</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
<span style='color:#800080; '>}</span>
</pre>
  <!--Created using ToHtml.com on 2020-05-05 19:14:21 UTC -->

  <BR><img src="https://github.com/hosseinmoein/DataFrame/blob/master/docs/LionLookingUp.jpg?raw=true" alt="C++ DataFrame"
       width="200" height="200" style="float:right"/>

</body>
</html>

<!--
Local Variables:
mode:HTML
tab-width:4
c-basic-offset:4
End:
-->
